#include <iostream>
#include <unistd.h>
using namespace std;
int main(){
   pid_t id = fork();
   if(id == 0){
       while(1){
        cout << "子进程pid: " << getpid() << " ppid: " << getppid() << " return: "\
          << id << endl;
        sleep(1);
       }
   }
   else if(id > 0){

       while(1){
        cout << "父进程pid: " << getpid() << " ppid: " << getppid() << " return: "\
          << id << endl;
        sleep(1);
         }
   }
   else{
        
   }

    
    
    return 0;
}
